import axios from './eco/base'

// 权限设置页面：查询组织机构树结构
export const queryOrgTreeList = (data) => {
  return axios.post('/unified-portal/base/queryOrgTreeList/' + data.orgId).then(res => {
    return res
  })
}
// 权限设置页面：查询教师列表
export const queryTeacherList = (data) => {
  return axios.post('/unified-portal/base/queryTeacherTreeList/' + data.orgId).then(res => {
    return res
  })
}
// 权限设置页面：查询班级列表
export const queryClassList = (data) => {
  return axios.post('/openapi-base/base/queryClassTreeList/' + data.orgId).then(res => {
    return res
  })
}
// 权限设置页面：查询学生列表
export const queryStudentList = (data) => {
  return axios.post('/openapi-base/base/queryStudentTreeList/' + data.orgId).then(res => {
    return res
  })
}

// 查询组织机构树结构
export const getOrgStructure = (data) => {
  return axios.post('/openapi-base/getOrgStructure', data).then(res => {
    return res
  })
}
// 查询机构
export const queryOrg = (data) => {
  return axios.get('/openapi-uc/org/' + data).then(res => {
    return res
  })
}
// 删除机构
export const deleteOrg = (data) => {
  return axios.post('/openapi-base/base/deleteOrg/' + data).then(res => {
    return res
  })
}
// 修改机构
export const updateOrg = (data) => {
  return axios.post('/openapi-base/base/updateOrg', data).then(res => {
    return res
  })
}
// 添加机构
export const addOrg = (data) => {
  return axios.post('/openapi-base/base/addOrg', data).then(res => {
    return res
  })
}
// 查询部门
export const queryDepartment = (data) => {
  return axios.get('/openapi-uc/org/queryDepartment?orgId=' + data).then(res => {
    return res
  })
}
// 删除部门
export const deleteDepartment = (data) => {
  return axios.post('/openapi-uc/org/deleteDepartment', data).then(res => {
    return res
  })
}
// 修改部门
export const updateDepartment = (data) => {
  return axios.post('/openapi-uc/org/updateDepartment', data).then(res => {
    return res
  })
}
// 添加部门
export const addDepartment = (data) => {
  return axios.post('/openapi-uc/org/addDepartment', data).then(res => {
    return res
  })
}

// 添加行政班
export const addClass = (data) => {
  return axios.post('/openapi-base/base/addClass', data).then(res => {
    return res
  })
}

// 查询教师列表
export const queryTeachers = (data) => {
  let params = {
    jobNumberSearch: '',
    loginNameSearch: '',
    loginMobile: '',
    userIdSearch: '',
    jobStatus:0,
    orgId: '',
    departmentId: '',
    name: '',
    loginName: '',
    pageNo:1,
    numPerPage:10,
    lastModifyTime: '',
    orderMethods:[],
    getHeadPic:true,
    ...data
  }
  Object.keys(params).forEach((key) => {
    if (params[key] === '') {
      delete params[key]
    }
  })
  return axios.post('/openapi-base/base/queryTeachers', params).then(res => {
    return res
  })
}
// 添加老师
export const addTeacher = (data) => {
  return axios.post('/openapi-base/base/addTeacher', data).then(res => {
    return res
  })
}
// 修改老师
export const updateTeacher = (data) => {
  return axios.post('/openapi-base/base/updateTeacher', data).then(res => {
    return res
  })
}
// 删除老师
export const delTeacherList = (data) => {
  return axios.post('/openapi-base/base/delTeacherList', data).then(res => {
    return res
  })
}
// 查询班级学生
export const queryClassStudent = (data) => {
  return axios.get('/openapi-base/base/queryClassStudent/' + data).then(res => {
    return res
  })
}
// 查询行政班下的学生
export const queryClassStudentSit = (data) => {
  return axios.post('/openapi-base/base/queryClassStudentSit', data).then(res => {
    return res
  })
}
// 查询教学班下的学生
export const queryClassStudentSite = (data) => {
  return axios.post('/openapi-base/base/queryClassStudentSite', data).then(res => {
    return res
  })
}
// 添加学生
export const addStudent = (data) => {
  return axios.post('/openapi-base/base/addStudent', data).then(res => {
    return res
  })
}
// 修改学生
export const updateStudent = (data) => {
  return axios.post('/openapi-base/base/updateStudent', data).then(res => {
    return res
  })
}
// 删除学生
export const delStudent = (data) => {
  return axios.post('/openapi-base/base/delStudent', data).then(res => {
    return res
  })
}